<?php
$plugin->load_plugin_lang();

$score = 0;
$tpl = new Template_plugin('course/plugin/quizz_qcm1/templates/index.tpl');

if($_POST)
{

	$response = retrieve(POST, 'response', '');
	if($response != '')
	{
		$question = $Sql->query("SELECT test FROM phpboost_plugin_quizz_qcm1 WHERE id=".$module->get_module_id_created_module(),__LINE__,__FILE__);
		if($question == $response)
			$score +=100;
		$result_saving = $plugin->save_score($score, $module_lp->get_module_id(), $_SERVER['PHP_SELF']);
		if(!$result_saving)
		{
			$tpl->assign_vars(array(
				'EXERCISE_DONE' => true,
			));
		}
		else
		{
			redirect($currentLink.'save&score='.$score);
		}
	}
	
}



$tpl->assign_vars(array(
	'FORM_ACTION' => $currentLink,
	
));

$tpl->parse();
?>